<?php
declare (strict_types=1);

namespace app\api\controller\yuql;

use app\logic\yuql\DistributionLogic;
use think\Request;

class Distribution
{

    /**
     * yuql
     * 佣金返佣控制层
     * @param Request $request
     * @return \think\response\Json
     */
    public function rebate(Request $request)
    {
        try {
            $params = $request->get();
            $result = DistributionLogic::goodsOrderStatus($params);
            return writeJson(1001, $result, '佣金信息入库成功');
        } catch (\Exception $e) {
            return writeJson(1002, '', $e->getMessage());
        }
    }

    /**
     * yuql
     * 佣金排行榜
     * @param Request $request
     * @return \think\response\Json
     */
    public function rankingList(Request $request)
    {
        try {
            $params = $request->get();
            $result = DistributionLogic::sortList($params);
            return writeJson(1001, $result, '排行榜展示成功');
        } catch (\Exception $e) {
            return writeJson(1002, '', $e->getMessage());
        }
    }
}
